package tools

import (
	"os"
	"path/filepath"
)

func FindFile(dir string, file string) ([]string, error) {
	var filePath []string
	err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
		// TODO：这儿要用正则
		if file == info.Name() {
			filePath = append(filePath, info.Name())
			return nil
		}
		return nil
	})
	return filePath, err
}

func IsDir(path string) bool {
	s, err := os.Stat(path)
	if err != nil {
		return false
	}
	return s.IsDir()
}
